package com.koalac.ironman.net.pojo.response;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * 用户
 * 
 * @author cyleung Jun 19, 2014
 */
public class User extends BaseResponse {
    /**
     * 授权码
     */
    private String token = "";
    

    private String id;
    private String user_name;
    
    private String password;
    private String register_time;
    private String sex;
    
    private String head_img_url;
    private String account;
    private String school;
    
    private String classes;
    private String region;
    private String message;
    
    private String device_id;
    private String hobby;
    

    public static final String SEX_MALE = "male";
    public static final String SEX_FEMALE = "female";

    public void init(JSONObject source) {
	if (null != source) {
	    id = source.optString("id");
	    token = source.optString("m_auth");
	    user_name = source.optString("user_name");
	    
	    password = source.optString("password");
	    register_time = source.optString("register_time");
	    sex = source.optString("sex");
	    
	    head_img_url = source.optString("head_img_url");
	    account = source.optString("account");
	    school = source.optString("school");
	    
	    classes = source.optString("classes");
	    region = source.optString("region");
	    message = source.optString("message");
	    
	    device_id = source.optString("device_id");
	    hobby = source.optString("hobby");
	}

    }
    public String getHobby() {
        return hobby;
    }

    public void setHobby(String hobby) {
        this.hobby = hobby;
    }

    public JSONObject toJSONObject() throws JSONException {
	JSONObject obj = new JSONObject();
	obj.put("id", id);
	obj.put("m_auth", token);
	obj.put("user_name", user_name);
	
	obj.put("password", password);
	obj.put("register_time", register_time);
	obj.put("sex", sex);
	
	obj.put("head_img_url", head_img_url);
	obj.put("account", account);
	obj.put("school", school);
	
	obj.put("classes", classes);
	obj.put("region", region);
	obj.put("message", message);
	
	obj.put("device_id", device_id);
	return obj;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUser_name() {
        return user_name;
    }

    public void setUser_name(String user_name) {
        this.user_name = user_name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getRegister_time() {
        return register_time;
    }

    public void setRegister_time(String register_time) {
        this.register_time = register_time;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getHead_img_url() {
        return head_img_url;
    }

    public void setHead_img_url(String head_img_url) {
        this.head_img_url = head_img_url;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getSchool() {
        return school;
    }

    public void setSchool(String school) {
        this.school = school;
    }

    public String getClasses() {
        return classes;
    }

    public void setClasses(String classes) {
        this.classes = classes;
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getDevice_id() {
        return device_id;
    }

    public void setDevice_id(String device_id) {
        this.device_id = device_id;
    }
    
}
